package com.xinchuang.controller.targetSystem;

import com.alibaba.fastjson.JSONObject;
import com.xinchuang.common.Result;
import com.xinchuang.service.targetSystem.EmulateService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 仿真
 */
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/emulate")
public class EmulateController {

    private final String ADD_UPDATE_EMULATE = "/addOrUpdate";
    private final String DELETE_UPDATE_EMULATE = "/delete";
    private final String SELECT_UPDATE_EMULATE = "/select";
    private final String CHOOSE_EMULATE = "/choose";
    private final String TO_MAP_EMULATE = "/toMap";
    private final String TO_MAP_EMULATE_EXTEND = "/toMapExtend";

    private final EmulateService emulateService;

    @PostMapping(value = ADD_UPDATE_EMULATE)
    public Result addUpdateEmulate(@RequestBody JSONObject json) {
        return emulateService.addOrUpSystemsEmulationData(json);
    }

    @PostMapping(value = DELETE_UPDATE_EMULATE)
    public Result deleteEmulate(@RequestBody JSONObject json) {
        return emulateService.deleteSystemsEmulationData(json);
    }

    @PostMapping(value = SELECT_UPDATE_EMULATE)
    public Result selectEmulate(@RequestBody JSONObject json) {
        return emulateService.selectSystemsEmulationData(json);
    }

    @PostMapping(value = CHOOSE_EMULATE)
    public Result chooseEmulation(@RequestBody JSONObject json) {
        return emulateService.chooseEmulation(json);
    }

    @PostMapping(value = TO_MAP_EMULATE)
    public Result toMapEmulate(@RequestBody JSONObject json) {
        return emulateService.mapToEmulate(json);
    }

    @PostMapping(value = TO_MAP_EMULATE_EXTEND)
    public Result mapToEmulateExtend(@RequestBody JSONObject json) {
        return emulateService.mapToEmulateExtend(json);
    }

}
